<?php

namespace plugin\admin\app\controller\font;


use plugin\admin\app\logic\font\FontLogic;
use support\Request;
use support\Response;
use plugin\admin\app\controller\AuthController;
use support\exception\BusinessException;

class IndexController extends AuthController
{
    
    /**
     * 浏览
     * @return Response
     */
    public function index(): Response
    {
        return view('font/index/index');
    }

    /**
     * 查询
     * @param Request $request
     * @return Response
     * @throws BusinessException
     */
    public function select(Request $request): Response
    {
        return FontLogic::getInstance()->select($request);
    }

    /**
     * 插入
     * @param Request $request
     * @return Response
     * @throws BusinessException
     */
    public function insert(Request $request): Response
    {
        if ($request->method() === 'POST') {
            return FontLogic::getInstance()->insert($request);
        }
        return view('font/index/insert');
    }

    /**
     * 更新
     * @param Request $request
     * @return Response
     * @throws BusinessException
    */
    public function update(Request $request): Response
    {
        if ($request->method() === 'POST') {
            return FontLogic::getInstance()->update($request);
        }
        return view('font/index/update');
    }

    /**
     * 删除
     * @param Request $request
     * @return Response
     * @throws \support\exception\BusinessException
     */
    public function delete(Request $request): Response
    {
        return FontLogic::getInstance()->delete($request);
    }
}
